home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / dlx70bbs.zip / DLX70SRC.ZIP / SCRIPT3.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-26  |  24KB  |  570 lines

  1. {$debug-}
  2. {$line-}
  3.  
  4. {$include: 'types.int'}
  5. {$include: 'globals.int'}
  6. {$include: 'utils.int'}
  7. {$include: 'funs.int'}
  8. {$include: 'fs_pkg.int'}
  9. {$include: 'database.int'}
  10. {$include: 'load.int'}
  11. {$include: 'sutils.int'}
  12. {$include: 'script3.int'}
  13.  
  14. IMPLEMENTATION OF script3;
  15.  
  16. USES types,globals,utils,funs,fs_pkg,database,load,sutils;
  17.  
  18. {DLX Bulletin Board System V7.0
  19.  
  20.  FREEWARE NOTICE
  21.  
  22.  DLX V7.0 is placed in the public domain by its author, Richard Gillmann.
  23.  Anyone who wishes to may run the program, copy it, or modify it for
  24.  any purpose, including commercial gain.}
  25.  
  26. {***Interface to the PASASM assembler utilities package***}
  27. {$include: 'pasasm.int'}
  28.  
  29. procedure bbs3{consts s : lstring; var str : lstring};
  30. var
  31.   i,j,k : integer;
  32.   i4,j4 : integer4;
  33.   next_state : task;
  34.   p : para;
  35.   h : mailhead;
  36.   fl : boolean;
  37.  
  38. begin
  39.   next_state:=succ(q[wx].state);
  40.   case q[wx].state of
  41.   userlog:
  42.     [if (q[wx].count<userlog_entries) and then
  43.         ((q[wx].index<>userlog_next) or (q[wx].count=0)) then
  44.        [q[wx].count:=q[wx].count+1; q[wx].index:=q[wx].index-1;
  45.         if q[wx].index<=0 then q[wx].index:=userlog_entries;
  46.         dbg_userlog(q[wx].index,userlog_buffer);
  47.     if ivalue(userlog_buffer.userlevel)>=priv_log then
  48.           display(userlog_line_txt)
  49.         else
  50.           [if disk2u(ivalue(userlog_buffer.userid)) and then
  51.           ivalue(q[wx].your.userlevel)>=priv_log
  52.              then display(userlog_line_txt)];
  53.         next_state:=userlog]
  54.      else
  55.        next_state:=main_menu];
  56.   sendmail_prompt: prompt_with(file_number_txt);
  57.   sendmail_to:
  58.     [make_number(s,str);
  59.      if number_query(str,1,largest_member_number,i) then
  60.        [q[wx].correspondent:=i;
  61.         if disk2u(i) then
  62.           [i:=ivalue(q[wx].your.mbx_count);
  63.            j:=ivalue(q[wx].your.mbx_max);
  64.            if i<max_max_mbx and then ((i<j) or (q[wx].level=9))
  65.              then display(to_from_txt)
  66.              else [display(no_slots_txt); next_state:=main_menu]]
  67.         else
  68.           [display(bad_userid_txt); next_state:=main_menu]]
  69.      else
  70.        [display(bad_userid_txt); next_state:=main_menu]];
  71.   correct3: prompt_with(cor_txt);
  72.   sendmail_subject:
  73.     if agree(s) then
  74.       [prepare_header; prompt_with(enter_subject_txt)]
  75.     else
  76.       [prompt_with(file_number_txt); next_state:=sendmail_to];
  77.   enter_subject:
  78.     if s.len=0 then
  79.       [display(msg_cancelled_txt); next_state:=sendmail_cancel]
  80.     else
  81.       [p:=newpara(ss[22]); concat(p^.msg,': '); {Subject: }
  82.        cat(p^.msg,s); q[wx].msg_last^.link:=p; q[wx].msg_last:=p;
  83.        p:=newpara(null); q[wx].msg_last^.link:=p; q[wx].msg_last:=p;
  84.        if q[wx].flag
  85.          then display(enter_body_txt)
  86.          else [prompt_with(which_canned_txt); next_state:=canned1]];
  87.   enter_body1:
  88.     [q[wx].send_line_count:=1; q[wx].count:=1; prompt_with(send_line_txt)];
  89.   enter_body2:
  90.     if s[0]=chr(0) then
  91.       [if q[wx].return_state=junk2 then q[wx].index:=largest_member_number;
  92.        display(msg_cancelled_txt); next_state:=sendmail_cancel]
  93.      else
  94.       [p:=newpara(s); q[wx].msg_last^.link:=p; q[wx].msg_last:=p;
  95.        q[wx].send_line_count:=q[wx].send_line_count+1;
  96.        q[wx].count:=q[wx].count+1;
  97.        prompt_with(send_line_txt)];
  98.   enter_body3:
  99.     if s[0]=chr(0) then
  100.       [prompt_with(send_menu_txt); next_state:=sendmail_fork]
  101.     else
  102.       [p:=newpara(s); q[wx].msg_last^.link:=p; q[wx].msg_last:=p;
  103.        q[wx].send_line_count:=q[wx].send_line_count+1;
  104.        q[wx].count:=q[wx].count+1;
  105.        if q[wx].send_line_count<=msg_line_limit or else q[wx].level=9 then
  106.          [prompt_with(send_line_txt); next_state:=enter_body3]
  107.        else
  108.          [prompt_with(send_menu_txt); next_state:=sendmail_fork]];
  109.   sendmail_menu: prompt_with(send_menu_txt);
  110.   sendmail_fork:
  111.     [next_state:=sendmail_menu;
  112.      if str=null then
  113.        display(dunno_txt)
  114.      else if str[1]=mn[10][1] {?} or else eq(str,ss[40]) {HELP} then
  115.        display(send_menu_list_txt)
  116.      else if str.len=1 and then str[1]=mn[10][2] {A} then
  117.        [if q[wx].send_line_count<=msg_line_limit or else q[wx].level=9 then
  118.           [q[wx].count:=q[wx].send_line_count;
  119.            prompt_with(send_line_txt); next_state:=enter_body3]
  120.         else display(too_long_txt)]
  121.      else if str.len=1 and then str[1]=mn[10][9] {D} then
  122.        [prompt_with(delete_line_txt); next_state:=sendmail_delete1]
  123.      else if str.len=1 and then str[1]=mn[10][3] {E} then
  124.        [prompt_with(edit_which_txt); next_state:=sendmail_edit1]
  125.      else if str.len=1 and then str[1]=mn[10][4] {H} and then
  126.           q[wx].return_state<>junk2 then
  127.        [q[wx].holding:=true;
  128.         if q[wx].return_state=pubmail5
  129.           then q[wx].hold_target:=-1
  130.           else q[wx].hold_target:=q[wx].correspondent;
  131.         display(msg_held_txt); next_state:=q[wx].return_state]
  132.      else if str.len=1 and then str[1]=mn[10][5] {L} then
  133.        [prompt_with(what_line_txt); next_state:=sendmail_list]
  134.      else if str.len=1 and then str[1]=mn[10][6] {R} then
  135.        [prompt_with(replace_line_txt); next_state:=sendmail_replace1]
  136.      else if str.len=1 and then str[1]=mn[10][7] {S} then
  137.        case q[wx].return_state of
  138.          pubmail5 : [display(pub_sending_txt); next_state:=sending];
  139.          junk2 : [q[wx].index:=0; q[wx].holding:=false;
  140.                   display(sending_txt); next_state:=junk2];
  141.          otherwise
  142.            [if disk2u(q[wx].correspondent) then
  143.               [display(sending_txt); next_state:=sending]
  144.             else
  145.           [q[wx].dos_err:=-2; {corrupt members file?}
  146.            display(mail_not_sent_txt)]];
  147.        end {case}
  148.      else if str.len=1 and then str[1]=mn[10][8] {X} then
  149.        [if q[wx].return_state=junk2 then q[wx].index:=largest_member_number;
  150.         display(msg_cancelled_txt); next_state:=sendmail_cancel]
  151.      else if eq(str,ss[37]) or else eq(str,ss[38]) or else eq(str,ss[39]) then
  152.        {BYE, OFF, EXIT}
  153.        next_state:=snip
  154.      else if str.len>2 and then
  155.              str[1]=mn[7][2] {/} and then str[2]=mn[7][4] {P} then {/P}
  156.        SlashP(s,str)
  157.      else
  158.        [prompt_with(send_menu_txt); next_state:=sendmail_fork]];
  159.   sendmail_list:
  160.     if s=null or else number_query(s,1,q[wx].send_line_count-1,i) then
  161.       [if s=null then i:=1;
  162.        p:=q[wx].msg_first; q[wx].count:=i;
  163.        for j:=1 to i+4 do
  164.          if p=nill then [q[wx].count:=0; break] else p:=p^.link;
  165.        q[wx].msg_ptr:=p; display(sendmail_line_txt)]
  166.     else
  167.       [display(bad_line_number_txt); next_state:=sendmail_menu];
  168.   sendmail_list2:
  169.     [if q[wx].msg_ptr<>nill then q[wx].msg_ptr:=q[wx].msg_ptr^.link;
  170.      if q[wx].msg_ptr=nill then
  171.        [prompt_with(send_menu_txt); next_state:=sendmail_fork]
  172.      else
  173.        [q[wx].count:=q[wx].count+1;
  174.         display(sendmail_line_txt); next_state:=sendmail_list2]];
  175.   sendmail_edit1:
  176.     if number_query(s,1,q[wx].send_line_count-1,i) then
  177.       [p:=q[wx].msg_first; q[wx].count:=i;
  178.        for j:=1 to i+4 do
  179.          if p=nill then [q[wx].count:=0; break] else p:=p^.link;
  180.        q[wx].msg_ptr:=p; display(sendmail_line_txt)]
  181.     else
  182.       [display(bad_line_number_txt); next_state:=sendmail_menu];
  183.   sendmail_edit2: prompt_with(enter_new_line_txt);
  184.   sendmail_edit3:
  185.     [kopylst(s,q[wx].msg_ptr^.msg);
  186.      prompt_with(send_menu_txt); next_state:=sendmail_fork];
  187.   sendmail_replace1:
  188.     if number_query(s,1,q[wx].send_line_count-1,i) then
  189.       [p:=q[wx].msg_first; q[wx].count:=i;
  190.        for j:=1 to i+4 do
  191.          if p=nill then [q[wx].count:=0; break] else p:=p^.link;
  192.        q[wx].msg_ptr:=p; display(sendmail_line_txt)]
  193.     else
  194.       [display(bad_line_number_txt); next_state:=sendmail_menu];
  195.   sendmail_replace2: prompt_with(text_old_txt);
  196.   sendmail_replace3:
  197.     [if q[wx].verify_data=nill
  198.        then q[wx].verify_data:=newpara(s)
  199.        else kopylst(s,q[wx].verify_data^.msg);
  200.      prompt_with(text_new_txt)];
  201.   sendmail_replace4: {msg_ptr = original text, verify_data = old, s = new}
  202.     [if q[wx].msg_ptr<>nill and then q[wx].verify_data<>nill then
  203.        [k:=0;
  204.         fo